<%@ page contentType="text/html;charset=utf-8" language="java"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> 
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<html:html>
<head>
		<META http-equiv=Content-Type content="text/html; charset=utf-8">
		<LINK href="../styles/stylewang.css"  type=text/css rel=stylesheet>
		<LINK href="styles/stylewang.css"  type=text/css rel=stylesheet>
		<LINK href="xtree.css"  type=text/css rel=stylesheet>
		<style type="text/css"></style>
		<title>CGProject</title>
		<html:base/>
</head>
<body onLoad="top.B.location.href='<%=request.getContextPath() %>/frame.do?Frame=12&Id=17'">
<table border="0" width="100%" cellspacing="0" id="table6">
	<tr>
		<td colspan="3" width="85%" id="onlybt">&nbsp;
		<logic:equal name="Type" value="Element">
		<b><bean:message key="element"/>&nbsp;<font color="#990000"><bean:write name="Unit" property="elementName"/></font>&nbsp;<bean:message key="element.makerelations"/> </b>
		</logic:equal>
		<logic:equal name="Type" value="Shot">
		<b><bean:message key="shot"/>&nbsp;<font color="#990000"><bean:write name="Unit" property="shotName"/></font>&nbsp;<bean:message key="shot.makerelations"/> </b>
		</logic:equal>


		</td>
	</tr>
	<logic:empty name="Relations">
	<tr>
		<td colspan="3" width="85%" id="rightbottom">&nbsp;
		<b><font color="#990000"><bean:message key="norelations"/> &nbsp;!</font></b>
		</td>
	</tr>
	</logic:empty>
	<logic:notEmpty name="Relations">
	<tr>
		<td width="17%" id="btleftbian">
		&nbsp;&nbsp;<bean:message key="make.premake"/></td>		
		<td width="17%" id="btcenterbian">
		&nbsp;&nbsp;<bean:message key="make.nextmake"/></td>		
		<td width="53%" id="btrightbian">
		　</td>		
	</tr>

	<logic:iterate id="element" name="Relations">
	<tr>
		<td width="17%" id="leftcenter">
		&nbsp;&nbsp;<bean:write name="element" property="makeByMake1id.makeName"/></td>		
		<td width="17%" id="leftcenter">
		&nbsp;&nbsp;<bean:write name="element" property="makeByMake2id.makeName"/></td>		

		<td width="53%" id="rightcenter">
		&nbsp;<html:link page="/delMakeRela.do" paramId="ID" paramName="element" paramProperty="makeRelationId" onclick="return   confirm('Confirm Delete')">[<bean:message key="delete"/>]</html:link></td>				
	</tr>
	</logic:iterate>
	<tr><td id="tdtop" colspan="3" width="100%">&nbsp;</td></tr>
	</logic:notEmpty>
	</table>
	<html:form action="/addMakeRelation">
	<table border="0" width="100%" cellspacing="0" id="tabletable" cellpadding="0">
	
		<logic:equal name="Type" value="Element">
			<html:hidden property="type" value="Element"/>		
		</logic:equal>
		<logic:equal name="Type" value="Shot">
			<html:hidden property="type" value="Shot"/>		
		</logic:equal>
		<tr>
			<td width="8%" id="btleftbian"><font color="#990000">&nbsp;<bean:message key="make.addrelation"/></font></td>
			<td width="46%" id="btcenterbian">
			<bean:message key="make.premake"/></td>
			<td width="46%" id="btrightbian">
			<bean:message key="make.nextmake"/></td>

		</tr>	


		<tbody id="tbDetailUsed">
		<tr>
			<td width="8%" id="leftcenter">　</td>
			<td width="46%" id="leftcenter">
			<html:select property="make1" style="border:1px solid #C0C0C0; font-family: Tahoma; font-size: 11px">
					<html:options  collection="Makes"
								   property="makeId"
								   labelProperty="makeName"/>
			</html:select>
			</td>
			<td width="46%" id="rightcenter">
			<html:select property="make2" style="border:1px solid #C0C0C0; font-family: Tahoma; font-size: 11px">
					<html:options  collection="Makes"
								   property="makeId"
								   labelProperty="makeName"/>
			</html:select></td>
		</tr>	
	
	
		</tbody>
		
		<tr>
			<td width="100%" id="rightbottom" colspan="3">
			<input type="button" value="Submit" name="B1" style="font-family: Tahoma; font-size: 11px" onClick="submitAddMakeRelation()">
		</tr>
		
		
	</table>
	</html:form>
</body>
</html:html>
<script language="javascript">
function submitAddMakeRelation()
{
	if(document.addMakeRelationForm.make1.value==document.addMakeRelationForm.make2.value)
	{
		alert("Make can not have relationship with itself");
		return;
	}
	document.addMakeRelationForm.submit();
}

</script>
